<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">

        <div><?php include "../public_flow/flow_show_info.php";?></div>

        <div class="table-box tablenes">
            <div class="title">基本信息</div>
            <table class="layui-table">
                <tbody>

                <tr><td class="tt">项目名称</td><td id="enginname" class="colorlan tv" colspan="3"></td></tr>
                <tr><td class="tt">预算主题</td><td id="budgetid_name" class="colorlan tv" colspan="3"></td></tr>


                <tr><td class="tt">变更单号</td><td class="tv" id="number" colspan="3"></td></tr>
                <tr><td class="tt">变更主题</td><td class="tv" id="zhuname" colspan="3"></td></tr>
                <tr><td class="tt">变更类型</td><td class="tv" id="type_name" colspan="3"></td></tr>
                <tr><td class="tt">备注</td><td class="tv" id="explain" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>

        <div><?php include "../public/upinfo_show.php";?></div>

        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>

        <div class="table-box tablenes layui-hide" id="tiaoDiv">
            <script type="text/html" id="toolbarDemo">调整明细</script>
            <div class="tableShow">
                <table id="datalist" lay-filter="datalist"></table>
            </div>
        </div>

        <div class="table-box tablenes layui-hide" id="zengDiv">
            <script type="text/html" id="toolbarDemo_zeng">增项明细</script>
            <div class="tableShow">
                <table id="datalist_zeng" lay-filter="datalist_zeng"></table>
            </div>
        </div>

        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>
</div>
<script>
    var param_id = getQueryVariable('id') || 0;

    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_engin_budbian_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;
                var budgetinfo = res.data.budgetinfo;

                $("#enginname").text(engininfo.name).click(function () {
                    openPage('../engin/show.php?id='+engininfo.id);
                });

                $("#budgetid_name").text(budgetinfo.name).click(function () {
                    openPage('../engin_budget/show.php?id='+budgetinfo.id);
                });

                $("#number").text(data.number);
                $("#zhuname").text(data.zhuname);
                $("#type_name").text(data.type_name);
                $("#explain").text(data.explain);

                if(data.type == 1 || data.type == 3){
                    $("#tiaoDiv").removeClass('layui-hide');
                }
                if(data.type == 2 || data.type == 3){
                    $("#zengDiv").removeClass('layui-hide');
                }

                var mytableList = table.render({
                    elem: "#datalist",data:res.data.tiaolist, toolbar: '#toolbarDemo', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',fixed:'left'}
                        ,{field: 'subname', title: '成本科目'}
                        ,{field: 'name', title: '名称及规格'}
                        ,{field: 'unit', title: '单位'}
                        ,{field: 'num', title: '预算数量'}
                        ,{field: 'price', title: '预算单价(元)'}
                        ,{field: 'money', title: '预算金额(元)'}
                        ,{field: 'new_num', title: '变更后数量'}
                        ,{field: 'new_price', title: '变更后单价(元)'}
                        ,{field: 'new_money', title: '变更后金额(元)'}
                        ,{field: 'explain', title: '变更原因'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });

                var mytableList22 = table.render({
                    elem: "#datalist_zeng",data:res.data.zenglist, toolbar: '#toolbarDemo_zeng', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',fixed:'left'}
                        ,{field: 'subname', title: '成本科目'}
                        ,{field: 'name', title: '名称及规格'}
                        ,{field: 'unit', title: '单位'}
                        ,{field: 'num', title: '预算数量'}
                        ,{field: 'price', title: '预算单价(元)'}
                        ,{field: 'money', title: '预算金额(元)'}
                        ,{field: 'explain', title: '说明'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });


                public_flow_show_display(res.data.billinfo);
                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('engin_budbian', param_id);
    });



</script>
</body>
</html>




